<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div id="app">
        <h1>{{message}}</h1>
        <ul v-if="names.length>0">
            <li v-for="item in names">{{item}}</li>
        </ul>

        <h2 v-else>条件不成立</h2>
    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
        //用vue创建app
        const app = Vue.createApp({
            // template: `

            // `,
            data() {
                return {
                    message: "Hello world",
                    // names:[]
                    names: ["a", "b", "c", "d"]
                }
            },
            methods: {

            }
        })
        //挂载app
        app.mount("#app")
    </script>

</body>

</html>